home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / UT_DSKFI / FORAGE.ZIP / FORAGE.DOC < prev    next >
Encoding:
Text File  |  1994-12-31  |  13.0 KB  |  289 lines

  1.  
  2.     =======================================================================
  3.     =======================================================================
  4.     ==========================                  ===========================
  5.     ==========================                  ===========================
  6.     ==========================      FORAGE      ===========================
  7.     ==========================                  ===========================
  8.     ==========================                  ===========================
  9.     =======================================================================
  10.     =======================================================================
  11.  
  12.  
  13.  
  14.          "ForAge" -- A Utility to Process Files by "Newest" or "Oldest"
  15.          Comes with a sample application - a handy quick backup utility
  16.  
  17.  
  18.          The FORAGE ("For Age") program is Copyright (C) 1992, 1994 by:
  19.  
  20.          Pinnacle Software, C-P 386 Mount Royal, Quebec, Canada H3P 3C6
  21.          U.S.  Office: Box 714 Airport Road, Swanton, Vermont 05488 USA
  22.  
  23.          Support Line: (514) 345-9578 -- Free Files BBS: (514) 345-8654
  24.  
  25.  
  26.  
  27.          --------------------------------------------------------------
  28.          This is a SHAREWARE product.   That means we would like you to
  29.          pass around unregistered copies to other people.   If you have
  30.          a modem,  please  upload it  to your  favourite bulletin board
  31.          system,  or give a copy to a friend  whom you think might need
  32.          a program like this.  Shareware means sharing!  Pass it on!
  33.          --------------------------------------------------------------
  34.  
  35.  
  36.  
  37.    ============================================================================
  38.                                     OVERVIEW
  39.    ============================================================================
  40.  
  41.    FORAGE lets you find the name of the newest (or oldest) file in a directory,
  42.    and pass that name to a DOS command.  This may not be something you have to
  43.    do every day, but when you need to do it, you'll discover that DOS doesn't
  44.    provide a convenient method to do that kind of thing.  Usually you end up
  45.    doing a DIR (sorted by date, perhaps) and reading through it until you find
  46.    the file you want.  But so many jobs are date-and time-dependant that we
  47.    need a utility like FORAGE to let us automate these tasks.
  48.  
  49.    TO INSTALL FORAGE:  Copy all of the files in the FORAGE package to a
  50.    directory that is located in your DOS PATH.  For details about the PATH
  51.    command, consult your DOS manual.
  52.  
  53.  
  54.    ============================================================================
  55.                                 HOW FORAGE WORKS
  56.    ============================================================================
  57.  
  58.    NOTE:  This tutorial assumes you understand the use of wildcards in file
  59.           masks.  For example, the DOS command DIR *.DAT uses the "*" wildcard
  60.           character to show a directory of all files with a DAT extension. For
  61.           more details about wildcards, consult your DOS manual.
  62.  
  63.    FORAGE is a DOS command which accepts command-line parameters.  The simplest
  64.    application is as follows:
  65.  
  66.    FORAGE N *.*
  67.  
  68.    When you type this command at the DOS prompt, FORAGE tells you the name of
  69.    the newest file in the current directory.   (Later on, we'll see how you can
  70.    pass that filename to another DOS command.)
  71.  
  72.    The "N" stands for "Newest".  You can replace it with "O", as follows:
  73.  
  74.    FORAGE O *.*
  75.  
  76.    This would tell you the name of the oldest file in the current directory.
  77.  
  78.    If you also needed to know the size of the oldest file, you could have
  79.    FORAGE call the DIR command, as follows:
  80.  
  81.    FORAGE O *.* DIR
  82.  
  83.    One frequent requirement in business is to move old data to a diskette.
  84.    You can copy the oldest file to a diskette as follows:
  85.  
  86.    FORAGE O *.* COPY @@ A:
  87.  
  88.    The @@ means "the file you found".  If @@ is not specified, it is assumed
  89.    that it goes at the end of the command.  Thus, the following two commands
  90.    are equivalent:
  91.  
  92.    FORAGE N *.* DIR
  93.    FORAGE N *.* DIR @@
  94.  
  95.    Getting back to the example of saving old data to a diskette, you'll find
  96.    that operations of that nature are very easy to do when you use FORAGE in
  97.    a batch (.BAT) file.  For a detailed example, refer to the section entitled
  98.    "SAMPLE BATCH FILES".
  99.  
  100.    Some additional examples are given later on.  See "MORE EXAMPLES".
  101.  
  102.  
  103.    ============================================================================
  104.                                COMMAND DEFINITION
  105.    ============================================================================
  106.  
  107.    The FORAGE command uses the following command formats:
  108.  
  109.    FORAGE age mask
  110.    FORAGE age mask command
  111.    FORAGE age mask command pre-fname
  112.    FORAGE age mask command @@ post-fname
  113.    FORAGE age mask command pre-fname @@ post-fname
  114.  
  115.    In standard notation, the formal definition is as follows:
  116.  
  117.    FORAGE age mask [ command [pre-fname] @@ [post-fname] ]
  118.  
  119.    The parameters are:
  120.  
  121.    age         Age specification, either [N]ewest or [O]ldest You can use the
  122.                full word, but only the first letter is checked.
  123.  
  124.    mask        File mask, using wildcards, to set the range of files to check.
  125.                For example, *.DAT checks all files with an extension of DAT.
  126.                For details about wildcards, consult your DOS manual.
  127.  
  128.    command     DOS command (fully qualified, or in current PATH).
  129.                If none is given, reports the name of file on console.
  130.  
  131.    pre-fname   Command-line parameters to pass BEFORE the filename.
  132.  
  133.    @@          Indicates where the filename goes when calling the command.
  134.                If @@ is not specified, the filename is assumed to go last.
  135.  
  136.    post-fname  Command-line parameters to pass AFTER the filename.
  137.  
  138.    FORAGE has a built-in help screen available.  To display it, enter the
  139.    following command at the DOS prompt:  FORAGE /?
  140.  
  141.  
  142.    ============================================================================
  143.                                  MORE EXAMPLES
  144.    ============================================================================
  145.  
  146.    EXAMPLE:   FORAGE /?
  147.    FUNCTION:  Displays two help screens, explaining how to use FORAGE
  148.  
  149.    EXAMPLE:   FORAGE O *.*
  150.    FUNCTION:  Displays the name of the oldest file in the directory
  151.  
  152.    EXAMPLE:   FORAGE N *.*
  153.    FUNCTION:  Displays the name of the newest file in the directory
  154.  
  155.    EXAMPLE:   FORAGE N C:\DOS\*.*
  156.    FUNCTION:  Displays the name of the newest file in the directory C:\DOS\
  157.  
  158.    EXAMPLE:   FORAGE N C:\DOS\*.EXE
  159.    FUNCTION:  Displays the name of the newest EXE file in the directory C:\DOS\
  160.  
  161.    EXAMPLE:   FORAGE O *.DAT DEL
  162.    FUNCTION:  Deletes the oldest file in the directory with a DAT extension
  163.  
  164.    EXAMPLE:   FORAGE O \DATA\*.DAT DEL
  165.    FUNCTION:  Deletes oldest DAT file in \DATA\ directory of the current drive
  166.  
  167.    EXAMPLE:   FORAGE N C:\TEXT\*.TXT MYBATCH.BAT
  168.    FUNCTION:  Passes the name of the newest TXT file in C:\TEXT\ to the batch
  169.               file MYBATCH.BAT (where it is accessible as the symbol %1)
  170.  
  171.    EXAMPLE:   FORAGE O *.DAT C:\MYPGMS\COPYOLD.EXE /v @@ /d/r
  172.    FUNCTION:  Passes the name of the oldest DAT file to the COPYOLD program,
  173.               along with some command-line parameters before and after the
  174.               filename.  If the oldest file was named MYDATA.DAT, it would be
  175.               as if you typed this command:  COPYOLD /v MYDATA.DAT /d/r
  176.  
  177.    EXAMPLE:   FORAGE newest *.* testnew @@ -x -y
  178.    FUNCTION:  Passes the name of the newest file to the testnew program,
  179.               followed by the command-line parameters.  If the oldest file was
  180.               named MYFILE.TXT, it would be as if you typed this command:
  181.               testnew MYFILE.TXT -x -y
  182.  
  183.  
  184.    ============================================================================
  185.                                   RETURN CODES
  186.    ============================================================================
  187.  
  188.    When you use FORAGE in a batch file, you should use "IF ERRORLEVEL" to check
  189.    if the utility actually found a file.
  190.  
  191.    IMPORTANT:  When using "IF ERRORLEVEL", you MUST check the higher values
  192.                first!  In other words, check 255 before 1, and 1 before 0.
  193.                This is because of the way "IF ERRORLEVEL" works.  See your
  194.                DOS manual for details.
  195.  
  196.    FORAGE sets ERRORLEVEL as follows:
  197.  
  198.  
  199.    ERRORLEVEL REASON
  200.    ---------- ------
  201.  
  202.        0      No problems -- file was found
  203.  
  204.        1      No file was found to match the mask
  205.  
  206.      255      Program error, or help screen was displayed
  207.  
  208.  
  209.    ============================================================================
  210.                                SAMPLE BATCH FILES
  211.    ============================================================================
  212.  
  213.    NOTE: This is not a tutorial for batch file programming.   To find out more
  214.          about this useful, powerful feature of DOS, consult your DOS manual.
  215.          If you plan to do any batch programming, you should obtain a copy of
  216.          our "SEE Utilities".   These can be obtained from our support BBS, or
  217.          can be ordered as part of our "Amazing Shareware Promotion".  View or
  218.          print the text file AMAZE.DOC (included with FORAGE) for details.
  219.  
  220.    The FORAGE package includes several sample batch files.  These can be viewed
  221.    or edited with a standard text editor program (e.g. DOS EDIT, or a word-
  222.    processor in generic "DOS Text" mode).  These batch files are provided for
  223.    study rather than for immediate use.  But with a few minor modifications,
  224.    you may find that they're just what you need!  The batch files are:
  225.  
  226.    SAVEOLD.BAT  Copies the oldest file in the directory with a DAT extension to
  227.                 a diskette, then deletes the file.
  228.  
  229.    SAFE.BAT     A backup program that uses the PKZIP file compression utility
  230.                 (created by Phil Katz of PKWare) to perform a quick and easy
  231.                 backup of your current directory.  This is ideal for people who
  232.                 wish to make safety copies of their work several times per day.
  233.                 SAFE maintains up to three backups (in compressed form) on a
  234.                 diskette.  By using two or more diskettes in this way, you can
  235.                 have plenty of backups!  It's easy to use SAFE: whenever you
  236.                 take a coffee break, just type SAFE and walk away.  Now there's
  237.                 no reason to be without a backup!
  238.  
  239.                 NOTE: The PKZIP utility is NOT included in the FORAGE package,
  240.                 but it can be found on almost any BBS in the world.  You can
  241.                 also call our support BBS and download a fine freeware
  242.                 alternative to PKZIP, named LHA.  The batch file can then be
  243.                 modified to use that compression utility instead.
  244.  
  245.                 If you have PKZIP, you can use SAFE immediately.  Make sure
  246.                 that these files are in your DOS PATH:
  247.  
  248.                 --------- Included with FORAGE ---------   ---Other---
  249.                 FORAGE.EXE   SAFE.BAT,  PINNACLE.EXE       PKZIP.EXE
  250.                 GETKEY.EXE   SAFE2.BAT                     PKUNZIP.EXE
  251.                 ----------------------------------------   -----------
  252.  
  253.                 Then log to a directory on your hard disk.  Insert a blank
  254.                 diskette in the A: drive, then type SAFE at the DOS prompt.
  255.                 This will backup all files.  You can also back up a subset by
  256.                 entering a file mask.  For example: SAFE *.DAT
  257.  
  258.    SAFE2.BAT    This is a utility batch file called by SAFE.BAT
  259.  
  260.  
  261.    ============================================================================
  262.                                   LEGAL NOTICE
  263.    ============================================================================
  264.  
  265.    FORAGE is presented on an "as is" basis, with no warranties or guarantees
  266.    expressed or implied.  The user bears complete responsibility for assessing
  267.    the usefulness and applicability of FORAGE to his or her application.
  268.    Under no circumstances will the author accept liability for any damages
  269.    arising from the use or misuse of FORAGE or its accompanying files.
  270.  
  271.  
  272.    ============================================================================
  273.                                    SHAREWARE
  274.    ============================================================================
  275.  
  276.    FOR ORDERING INFORMATION, PLEASE SEE THE TEXT FILES OPTIONS.DOC & ORDER.FRM.
  277.  
  278.    FORAGE is distributed as SHAREWARE, which means that, while we retain full
  279.    copyright, we encourage you to evaluate the product -- at no cost -- for a
  280.    reasonable period (about 45 days). You are invited to pass around unaltered,
  281.    unregistered copies of the package.  See the file VENDOR.DOC (included in
  282.    the FORAGE package) for complete distribution details.
  283.  
  284.    The Turbo Pascal source code for FORAGE may be purchased for in-house use
  285.    only, for $150.  You must be a registered FORAGE user to purchase source.
  286.  
  287.  
  288.  
  289.